{% load static %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>PASS</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #zhongbao_create_html{
            width: 200px;
            margin: 0 auto;
        }

        #zhongbao_upload_file_submit {
            background-color: #ea0808;
            border: none;
            color: white;
            padding: 8px 23px;
            text-align: center;
            text-decoration: none;
            display: inline-block;zhongbao_admin_testmodel
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="zhongbao_create_html">
    <button id="zhongbao_upload_file_submit" onclick="zhongbao_pass_api()">
        合格
    </button>
</div>
</body>
</html>

<script src="{% static 'plugins\jQuery\jquery-2.2.3.min.js' %}"></script>

<script type="text/javascript">

    function zhongbao_pass_api() {
        // 合格api
        $.ajax(
            {
                url: "{% url 'task:adopt' %}",
                type: "POST",
                dataType: "json",
                data: {'csrfmiddlewaretoken': '{{ csrf_token }}', 'tids': '{{ task_id }}'},
                success: function (result) {
                    alert(result.message);
                    window.close();
                },
                error: function (xhr, status, p3, p4) {
                    var err = "Error " + " " + status + " " + p3;
                    if (xhr.responseText && xhr.responseText[0] == "{")
                        err = JSON.parse(xhr.responseText).message;
                    alert(err + '合格状态修改失败！！！请点击重新修改');
                }
            });
    }

    {#function pass() {#}
    {#    // 获取下拉菜单的值#}
    {#    // 分组#}
    {#    var zhongbao_gid = $('#zhongbao_id_gid option:selected').val();#}
    {#    // 数据类型#}
    {#    var zhongbao_tid = $('#zhongbao_id_tid option:selected').val();#}
    {#    // 行业类型#}
    {#    var zhongbao_webtype = $('#zhongbao_id_webtype option:selected').val();#}
    {#    // 数据来源#}
    {#    var zhongbao_datasourcetype = $('#zhongbao_id_datasourcetype option:selected').val();#}
    {#    // 是否代理#}
    {#    var zhongbao_agent = $('#zhongbao_id_is_agent option:selected').val();#}
    {#    // 代理地址#}
    {#    var zhongbao_proxy_id = $('#zhongbao_id_proxy_addresses_id option:selected').val();#}
    {#    // 国家地区#}
    {#    var zhongbao_country = $('#zhongbao_id_country option:selected').val();#}
    {#    // 语  言#}
    {#    var zhongbao_language = $('#zhongbao_id_language option:selected').val();#}
    {##}
    {#    // redis api#}
    {#    $.ajax(#}
    {#        {#}
    {#            url: "{% url 'task:eligibleConfigRedis' %}",#}
    {#            type: "POST",#}
    {#            dataType: "json",#}
    {#            data: {#}
    {#                'conf_gid': zhongbao_gid,#}
    {#                'webtype': zhongbao_webtype,#}
    {#                'conf_tid': zhongbao_tid,#}
    {#                'uig': '', 'agent': zhongbao_agent,#}
    {#                'proxy_id': zhongbao_proxy_id,#}
    {#                'datasourcetype': zhongbao_datasourcetype,#}
    {#                'country': zhongbao_country,#}
    {#                'language': zhongbao_language,#}
    {#                'file_name': '{{ file_name }}',#}
    {#                'webname': '{{ webname }}',#}
    {#                'domain': '{{ domain }}',#}
    {#                'path': '/zhongbao/Public/Uploads/conf_file',#}
    {#                'csrfmiddlewaretoken': '{{ csrf_token }}',#}
    {#                'auditor': '{{ user }}',#}
    {#                'pass_time': new Date().getTime()#}
    {#            },#}
    {#            success: function (result) {#}
    {#                str = result.message;#}
    {#                if (str.indexOf("插入成功") != -1) {#}
    {#                    alert('插入成功');#}
    {#                    zhongbao_pass_api()#}
    {#                } else {#}
    {#                    alert('失败')#}
    {#                }#}
    {#            },#}
    {#            error: function (xhr, status, p3, p4) {#}
    {#                var err = "Error " + " " + status + " " + p3;#}
    {#                if (xhr.responseText && xhr.responseText[0] == "{")#}
    {#                    err = JSON.parse(xhr.responseText).message;#}
    {#                alert(err + '插入失败');#}
    {#            }#}
    {#        });#}
    {# }#}

</script>